package
{
	import com.airlogger.AirLoggerDebug;
	import flash.display.StageAlign;
	
	import flash.display.Sprite;
	import flash.display.StageScaleMode;
	import flash.external.ExternalInterface;
	import flash.system.Security;
	import flash.system.System;
	
	[SWF(width='16', height='9', frameRate='25')]
	public class jQueryLogger extends Sprite
	{
		public function jQueryLogger()
		{
			this.stage.scaleMode = StageScaleMode.NO_SCALE;
			this.stage.align = StageAlign.TOP_LEFT;
			
			Security.allowDomain("*");
			
			if (ExternalInterface.available){
				ExternalInterface.addCallback("debug",AirLoggerDebug.DEBUG);
				ExternalInterface.addCallback("info",AirLoggerDebug.INFO);
				ExternalInterface.addCallback("warn",AirLoggerDebug.WARN);
				ExternalInterface.addCallback("error",AirLoggerDebug.ERROR);
				ExternalInterface.addCallback("fatal", AirLoggerDebug.FATAL);
				ExternalInterface.addCallback("setTabName",_setTabName);
				ExternalInterface.call("$.fn.airLogger.activate");
			}
			
			var _width:Number = 16;
			var _height:Number = 9;
			
			this.graphics.beginFill(0xa40000);
			this.graphics.drawRect(0, 0, _width/2, _height/2);
			this.graphics.drawRect(_width/2, _height/2, _width/2, _height/2);
			this.graphics.beginFill(0x2b1c1c);
			this.graphics.drawRect(_width/2, 0, _width/2, _height/2);
			this.graphics.drawRect(0, _height / 2, _width / 2, _height / 2);		
			
			this.alpha = 0;
			
		}
		private function _setTabName(pName:String):void {
			AirLoggerDebug.getInstance().setName(pName);
		}
	}
}